package com.sina.shop.service.order;

import com.sina.shop.domain.order.Order;
import com.sina.shop.domain.order.Status;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Description: 调用服务，并配置断路器，当调用出错时调用默认的配置。
 * 段浩杰   2018-01-31-17:40
 */
@FeignClient(value = "SHOP-SPRING-CLOUD-ALL", fallback = OrderServiceBack.class)
public interface OrderService {

    @RequestMapping(value = "/order/updateOrder", method = RequestMethod.POST)
    Order updateOrder(@RequestBody(required = false) Order order);

    @RequestMapping(value = "/order/updateOrderStatus", method = RequestMethod.POST)
    Integer updateOrderStatus(@RequestParam("adminId") Long adminId, @RequestParam("status") Status status);

    @RequestMapping(value = "/order/getOrderListByAdminId", method = RequestMethod.GET)
    List<Order> getOrderListByAdminId(@RequestParam("adminId") Long adminId, @RequestParam("status") Status status);

    @RequestMapping(value = "/order/getOrder", method = RequestMethod.GET)
    Order getOrder(@RequestParam("id") Long id);

    @RequestMapping(value = "/order/saveOrder", method = RequestMethod.POST)
    Order saveOrder(@RequestBody(required = false) Order order);

    @RequestMapping(value = "/order/deleteOrder", method = RequestMethod.POST)
    Integer deleteOrder(@RequestParam("id") Long id);

}
